package com.zxy.shaozhiyi1.main.test;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

public class WebTest2
{
    WebDriver driver;//new FirefoxDriver();
    
    @BeforeClass
    public void setup() 
    {
        
        System.setProperty("webdriver.chrome.driver", "D:\\geckodriver.exe");
        driver = new ChromeDriver();
        driver.get("https://www.baidu.com/");
        //driver.manage().window().maximize();
    }
    @Test
    public void test1()
    {
        //输入selenium查询
        driver.findElement(By.xpath(".//*[@id='kw']")).sendKeys("百度");
        //点击百度一下
        driver.findElement(By.xpath(".//*[@id='su']")).click();
        System.out.println("测试用例1");    
    }
    @Test
    public void test2()
    {
        System.out.println("测试用例2");
    }
    @AfterClass
    public void closed()
    {
        //关闭浏览器
        driver.quit();
        System.out.println("关闭浏览器成功");
    }
}